home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Gamer Resource Kit / Hardcore Gamer Resource Kit - Disc 3.iso / screensavers / saver17.zip / VoodooLights / Sources / cell_tp9.c < prev    next >
C/C++ Source or Header  |  1997-07-24  |  2KB  |  93 lines

  1. /*------------------------------------------------------/
  2. /                                                        /
  3. /    Copyright 1997, SΘrgio Durte <smd@di.fct.unl.pt>    /
  4. /                                                        /
  5. /------------------------------------------------------*/
  6.  
  7.  
  8. #include <stdlib.h>
  9. #include <math.h>
  10. #include <glide.h>
  11.  
  12. #include "defines.h"
  13. #include "mat.h"
  14. #include "rgb.h"
  15. #include "clip.h"
  16. #include "tex.h"
  17. #include "cam.h"
  18. #include "cell.h"
  19. #include "cell_util.h"
  20. #include "cell_tp9.h"
  21.  
  22. static Bool first_init = True ;
  23. static GrMipMapId_t tp9_texture_src ;
  24.  
  25. static void tp9_acc_cell(Cell *c) 
  26. {
  27. }
  28.  
  29. static void tp9_age_cell( Cell *c )
  30. {
  31.     c->age += dt ;
  32.     if( c->age > c->adulthood ) c->status = DYING ;
  33.     c->color.g *= 0.85 ;
  34.     if( c->color.g < 1 ) c->color.r *= 0.90 ;
  35. }
  36.  
  37. void tp9_set_glide_state( void )
  38. {
  39.     if( first_init ) {
  40.         first_init = False ;
  41.         tp9_texture_src = tex_InitTexture("flare1.3df") ;
  42.     }
  43.     
  44.     tex_SetTexSource( tp9_texture_src ) ;
  45.     guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB ) ;
  46.     guAlphaSource( GR_ALPHASOURCE_ITERATED_ALPHA );    
  47.     grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ONE, GR_BLEND_ONE, GR_BLEND_ZERO );
  48.  
  49. }
  50.  
  51. extern Float Time ;
  52.  
  53. Cell *ctp9_Constructor( Cell *dad )
  54. {
  55.  
  56.   Cell *c = cell_Constructor( CellType9 ) ;
  57.  
  58.   c->max_speed = 65.0 ;
  59.  
  60.   c->dad = dad ;
  61.  
  62.   c->max_chld = 1 ;
  63.   c->p_chld = 0.0 ;
  64.  
  65.   c->adulthood = 1.5 ;
  66.   c->size = 4.0 ;
  67.  
  68.   
  69.   c->color.r = 200.0 ;
  70.   c->color.g = 120.0 ;
  71.   c->color.b = 0.0 ;
  72.   c->color.a = 1.0 ;
  73.  
  74.   c->sparkle = 1.0 ;
  75.   c->sparkle_range = 0.3 ;
  76.   c->sparkle_min = 0.5 ;
  77.  
  78.   c->acc_cell = tp9_acc_cell ; 
  79.   c->age_cell = tp9_age_cell ; 
  80.  
  81.   return c ;
  82. }  
  83.     
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.     
  92.  
  93.